<?php
use yii\helpers\Url;
use yii\Web\View;
use app\assets\CampaignLabelAsset;
/* @var $this yii\web\View */
CampaignLabelAsset::register($this);
$this->title = $this->context->pageTitle.Yii::$app->params['titleSuffix'];
$this->params['breadcrumbs'] = [
  \Yii::t('campaign-label', 'Campaign Label'),
  \Yii::t('common', 'Data')
];
$jsMsgs = $this->context->loadJsMsgs([
  'table',
  'listOp',
  'campaignLabel',
]);
$this->registerJs("VAM.setVar('LANGUAGE_JS', '".$jsMsgs."');", View::POS_HEAD);
?>
<div class="page-header">
  <h1>
    <?=\Yii::t('campaign-label', 'Campaign Label')?>
    <small><?=\Yii::t('campaign-label', 'Data List')?></small>
    <div class="btn-group btn-group-sm pull-right" role="group" aria-label="...">
      <div class="text-error btn hidden" id="all_tip">
        <?=\Yii::t('common', 'Please select the brand for add!')?>
      </div>
      <a href="<?= Url::to(['new-campaign-label']);?>" class="btn btn-success new-operate-btn" data-loading-text="<i class='fa fa-spinner fa-spin'></i> <?=\Yii::t('common', 'Loading')?>..." id="new-operate-btn">
        <i class="fa fa-plus-circle"></i>
        <?=\Yii::t('campaign-label', 'New Label')?>
      </a>
    </div>
  </h1>
</div>
<div class="panel panel-default">
  <div class="panel-heading"> 
    <i class="fa fa-table"></i>
    <?=\Yii::t('campaign-label', 'Campaign label list')?>
    <ul class="list-inline list-unstyled pull-right">
      <li>
        <a class="data-table-refresh" href="#" title="<?=\Yii::t('common', 'Click to refresh data')?>">
          <i class="fa fa-refresh"></i>
        </a>
      </li>
      <li>
        <a href="#">
          <i class="fa fa-chevron-up"></i>
        </a>
      </li>
    </ul>
  </div>
  <div class="panel-body pos-r">
    <div id="list-loading-wrap" class="local-loading-wrap"></div>
    <!-- <div class="table-responsive"> -->
      <table class="table table-hover table-striped table-bordered table-condensed" id="data-table" data-tag="vm-adserver.campaign-label-list">
        <thead class="heading">
          <tr>
            <th data-resizable-column-id="id" data-search="on" data-filter="on">ID</th>
            <th data-resizable-column-id="name" data-search="on" data-filter="on"><?=\Yii::t('campaign-label', 'Label Name')?></th>
            <th data-resizable-column-id="advertiser" data-search="on" data-filter="on"><?=\Yii::t('campaign-label', 'Advertiser')?></th>
            <th data-resizable-column-id="status" data-search="on" data-filter="on"><?=\Yii::t('campaign-label', 'Status')?></th>
            <th data-resizable-column-id="launchNum" data-search="on" data-filter="on"><?=\Yii::t('campaign-label', 'Campaign Num')?></th>
            <th data-resizable-column-id="comment" data-search="on" data-filter="on"><?=\Yii::t('campaign-label', 'Comment')?></th>
            <th data-resizable-column-id="modifiedDate" data-search="on" data-filter="on"><?=\Yii::t('campaign-label', 'Update Time')?></th>
            <th data-resizable-column-id="operate" data-filter="on"><?=\Yii::t('campaign-label', 'Actions')?></th>
          </tr>
        </thead>
        <tbody>
          <tr role="row">
            <td class="text-center dataTables_empty" colspan="8"><?=\Yii::t('site', 'No Records')?></td>
          </tr>
        </tbody>
      </table>
    <!-- </div> -->
  </div>
</div>  
<?php
  $dataList = Url::to(['get-campaign-labels']);
  $editUrl = Url::to(['campaign-label-edit']);
  $launchLinkUrl = Url::to(['launch/launch-list']);
  !$_SESSION['advertiser_id'] && $isAllBrand = true;
  $_SESSION['advertiser_id'] && $isAllBrand = false;
  $this->registerJs("VAM.setVar('DATA_LIST_URL','$dataList');",View::POS_HEAD);
  $this->registerJs("VAM.setVar('DATA_EDIT_URL','$editUrl');",View::POS_HEAD);
  $this->registerJs("VAM.setVar('LINK_URL','$launchLinkUrl');",View::POS_HEAD);
  $this->registerJs("VAM.setVar('IS_ALL_BRAND','$isAllBrand');",View::POS_HEAD);
?>
<script type="text/javascript" >
  requirejs(["<?= Yii::getAlias('@web/').Yii::$app->params['envDir'];?>/js/site.js"], function(common) {
    requirejs(["<?= Yii::getAlias('@web/').Yii::$app->params['envDir'];?>/js/label/labelList.js"]);
  });
</script>
